<?php

namespace Admin\Controller;

class FzjController extends BaseController
{
    public function updateopenid()
    {
        // $con['open_id'] = array('like','%o-6vD5%');
        // $user = M('users')->where($con)->field('user_id,nickname,head_pic')->select();

      

        // $all = M('users')->field('user_id,nickname,head_pic')->select();



    }


    public function deleteuserid()
    {

        //for($i=1280;$i<1285;$i++){

            //$this->deleteuser(1301);
           

       // }
        
    }



    private function deleteuser($user_id)
    {
       
        if(!$user_id){
            $this->error('id不存在');
            exit;
        }

        $con['user_id'] = $user_id;
        $user = M('users')->where($con)->find();
        if(!$user){
           echo $user_id.'用户不存在<br>';
           // exit;
        }


        $head_pic = '/home/wwwroot/shop.c3w.cc/Public/head/'.$user_id.'.jpg';
        unlink($head_pic);

        //删除tp_account_log
        M('account_log')->where(array('user_id'=>$user_id))->delete();
        
        M('cart')->where(array('user_id'=>$user_id))->delete();

        // tp_comment
        M('comment')->where(array('user_id'=>$user_id))->delete();

        // tp_coupon_list  uid
        M('coupon_list')->where(array('uid'=>$user_id))->delete();

        // tp_delivery_doc
        M('delivery_doc')->where(array('user_id'=>$user_id))->delete();

        // tp_donation_details
        M('donation_details')->where(array('user_id'=>$user_id))->delete();

        // tp_feedback
        M('feedback')->where(array('user_id'=>$user_id))->delete();

        // tp_order  tp_order_goods   order_id   tp_order_statis  ==  id   tp_pay  == order_id   tp_return_goods  == order_id
 
        // tp_order_action   action_user
        M('order_action')->where(array('action_user'=>$user_id))->delete();


        // tp_order_comment
        M('order_comment')->where(array('user_id'=>$user_id))->delete();


        // tp_rebate_log
        M('rebate_log')->where(array('user_id'=>$user_id))->delete();
        // tp_recharge
        M('recharge')->where(array('user_id'=>$user_id))->delete();

        // tp_remittance
        M('remittance')->where(array('user_id'=>$user_id))->delete();

        // tp_seller
        M('seller')->where(array('user_id'=>$user_id))->delete();

        // tp_user_address
        M('user_address')->where(array('user_id'=>$user_id))->delete();

        // tp_withdrawals
        M('withdrawals')->where(array('user_id'=>$user_id))->delete();

        M('users')->where(array('user_id'=>$user_id))->delete();

        echo $user_id."success<br>";
    }
}
